<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>重置密码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../../static/struct/layui256/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../../static/struct/layuimini/css/public.css" media="all">
    <link rel="stylesheet" href="../../../../static/struct/weui/weui.css " media="all">
    <script src="../../../../static/js/login/jquery.min.js" charset="UTF-8"></script>
    <script src="../../../../static/struct/layui256/layui.js" charset="utf-8"></script>
    <script type="text/javascript">
        function checkBtnVal() {
            if ($('#firstinput').val() == $('#secondinput').val() && $('#firstinput').val() != '' ) {
                $('#confirm').removeClass('layui-btn-disabled');
            } else {
                $('#confirm').addClass('layui-btn-disabled');
            }
        }
    </script>

    <script type="text/javascript">
        $(function() {
            var data = window.location.search.substring(1);
            if (data == '') {
                alert("地址无效");
                window.location.href = 'http://baidu.com';
            } else {
                $.ajax({
                    type: "post",
                    url: "/action/validurl",
                    data: JSON.stringify(data),
                    contentType: "application/json;charset=utf-8",
                    dataType: "json",
                    success: function (res) {
                        if(res.status == 'ok'){
                            console.log(res);
                        }else{
                            alert(res.status);
                            window.location.href = 'http://news.sina.com.cn';
                        }

                    }, error: function (error) {
                        alert("服务器出错");
                        window.location.href = 'http://news.sina.com.cn';
                    }
                });
            }
        });
    </script>

    <script src="../../../../static/struct/layui256/layui.js" charset="utf-8"></script>
    <script type="text/javascript">
        layui.use(['form', 'table','layer','laydate'], function () {
            var $ = layui.jquery,
                form = layui.form,
                table = layui.table,
                util = layui.util,
                layer = layui.layer,
                laydate = layui.laydate;

            $(document).ready(function () {
                $('#confirm').click(function () {
                    var data = window.location.search.substring(1) + '&' + $('#firstinput').val();
                    if ($('#firstinput').val() == $('#secondinput').val() && $('#firstinput').val() != '' ) {
                        $.ajax({
                            type: "post",
                            url: "/action/confirmPassword",
                            data: JSON.stringify(data),
                            contentType: "application/json;charset=utf-8",
                            dataType: "json",
                            success: function (res) {
                                console.log('res');
                                console.log(res);
                                layer.alert(res.status);
                                $('#confirm').addClass('layui-btn-disabled');
                                window.close();

                            }, error: function (error) {
                                console.log('error');
                                console.log(error);
                                alert(error.responseText);
                            }
                        });
                    }

                });
            });
        });
    </script>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <fieldset class="table-search-fieldset">
            <form class="layui-form layui-form-pane" action="">

                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                    <legend>Lims Mobile</legend>
                </fieldset>


                <div class="layui-form-item">
                    <input type="password" name="firstinput" id="firstinput" required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input" oninput="checkBtnVal()">
                    <div class="layui-inline">

                    </div>

                    <input type="password" name="secondinput" id="secondinput" required  lay-verify="required" placeholder="请确认密码" autocomplete="off" class="layui-input" oninput="checkBtnVal()">
                    <div class="layui-inline">


                    </div>

                    <button type="button" id="confirm" class="layui-btn layui-btn-fluid layui-btn-disabled " >确认修改</button>

                    <div class="weui-footer weui-footer_fixed-bottom">
                        <p class="weui-footer__links">
                            <a href="javascript:home();" class="weui-footer__link">Lims Mobile</a>
                        </p>
                        <p class="weui-footer__text">Copyright &copy; 2019-2020 besbing.cn</p>
                    </div>
                </div>

            </form>

        </fieldset>
    </div>
</div>


</body>
</html>